package com.ruoyi.process.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.process.domain.MealRecord;
import com.ruoyi.process.mapper.MealRecordMapper;
import com.ruoyi.process.service.IMealRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 陪餐记录Service业务层处理
 *
 * @author wng
 * @date 2024-08-04
 */
@Service
public class MealRecordServiceImpl implements IMealRecordService {
    @Resource
    private MealRecordMapper mealRecordMapper;

    /**
     * 查询陪餐记录
     *
     * @param id 陪餐记录主键
     * @return 陪餐记录
     */
    @Override
    public MealRecord selectMealRecordById(Long id) {
        return mealRecordMapper.selectMealRecordById(id);
    }

    /**
     * 查询陪餐记录列表
     *
     * @param mealRecord 陪餐记录
     * @return 陪餐记录
     */
    @Override
    public List<MealRecord> selectMealRecordList(MealRecord mealRecord) {
        return mealRecordMapper.selectMealRecordList(mealRecord);
    }

    /**
     * 新增陪餐记录
     *
     * @param mealRecord 陪餐记录
     * @return 结果
     */
    @Override
    public int insertMealRecord(MealRecord mealRecord) {
        mealRecord.setCreateTime(DateUtils.getNowDate());
        return mealRecordMapper.insertMealRecord(mealRecord);
    }

    /**
     * 修改陪餐记录
     *
     * @param mealRecord 陪餐记录
     * @return 结果
     */
    @Override
    public int updateMealRecord(MealRecord mealRecord) {
        mealRecord.setUpdateTime(DateUtils.getNowDate());
        return mealRecordMapper.updateMealRecord(mealRecord);
    }

    /**
     * 批量删除陪餐记录
     *
     * @param ids 需要删除的陪餐记录主键
     * @return 结果
     */
    @Override
    public int deleteMealRecordByIds(Long[] ids) {
        return mealRecordMapper.deleteMealRecordByIds(ids);
    }

    /**
     * 删除陪餐记录信息
     *
     * @param id 陪餐记录主键
     * @return 结果
     */
    @Override
    public int deleteMealRecordById(Long id) {
        return mealRecordMapper.deleteMealRecordById(id);
    }
}
